
package cn.javaxc.mvcwork.control.web;
import java.util.*;




public class HtmlOption {

  private String value = null;
  private String text = null;
  private String jsEvent = null;
  private HashMap attributeList = null;
  private boolean group = false;
  private boolean enabled = true;


  
  public HtmlOption() {
  }


  
  public HtmlOption(String value, String text) {
    this.value = value;
    this.text = text;
  }


  
  public HtmlOption(String value, String text, String jsEvent) {
    this.value = value;
    this.text = text;
    this.jsEvent = jsEvent;
  }


  
  public HtmlOption(String value, String text, HashMap attributeList) {
    this.value = value;
    this.text = text;
    this.attributeList = attributeList;
  }


  
  public HtmlOption(String value, String text, HashMap attributeList, boolean enabled) {
    this.value = value;
    this.text = text;
    this.attributeList = attributeList;
    this.enabled = enabled;
  }


  
  public void setValue(String value) {
    this.value = value;
  }


  
  public void setJsEvent(String jsEvent) {
    this.jsEvent = jsEvent;
  }


  
  public void setText(String text) {
    this.text = text;
  }


  
  public void setAttributeList(HashMap attributeList) {
    this.attributeList = attributeList;
  }


  
  public HashMap getAttributeList() {
    return attributeList;
  }


  
  public void setEnabled(boolean tmp) {
    this.enabled = tmp;
  }


  
  public boolean getEnabled() {
    return enabled;
  }


  
  public String getText() {
    return text;
  }


  
  public String getValue() {
    return value;
  }


  
  public String getJsEvent() {
    return jsEvent;
  }


  
  public void setGroup(boolean tmp) {
    this.group = tmp;
  }


  
  public boolean getGroup() {
    return group;
  }


  
  public boolean isGroup() {
    return group;
  }


  
  public void addAttribute(String attrName, String attrValue) {
    if (attributeList == null) {
      attributeList = new HashMap();
    }
    attributeList.put(attrName, attrValue);
  }


  
  public String getAttributes() {
    StringBuffer tmpList = new StringBuffer();
    if (attributeList != null) {
      Set s = attributeList.keySet();
      Iterator i = s.iterator();
      tmpList.append(" ");
      while (i.hasNext()) {
        Object name = i.next();
        tmpList.append(
            name.toString() + "='" + attributeList.get(name).toString() + "' ");
      }
    }
    return tmpList.toString();
  }
}
